#ifndef CPLUGINCONTROLLER_H
#define CPLUGINCONTROLLER_H
#include <vector>
#include "../serialize/CLSerializer.h"

class IGoodsPlugin;


class CPluginController
{
public:

	CPluginController(void);

	virtual ~CPluginController(void);

	bool InitializeController(std::string serverName);

	bool UninitializeController(void);

	bool ProcessRequest(int FunctionID);

	bool IfProcess(char *Function);
	
	bool ProcessSerialize(int m_serverId);

	bool ProcessDeserialize(int m_serverId);

	bool ProcessGetAllId(char *FunctionList[], int *num);

	bool ProcessSelectById(char *Function, int *price, int *stock);

	bool ProcessInsertById(char *Function, int num);
	
	bool ProcessDelineById(char *Function, int num);

	bool ProcessUpdatePriceById(char *Function, int newPrice);

	bool getPlugins(std::vector<IGoodsPlugin*> *vpPlugin);

	bool setPlugins(std::vector<IGoodsPlugin *> *vpPlugin);

private:
	
	// 动态链接库句柄
	std::vector<void *> m_vhForPlugin;
	// 插件createObj创建的对象
	std::vector<IGoodsPlugin*> m_vpPlugin;
	// 序列化控制
	CLSerializer m_serializer;
};

#endif
